﻿using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace Bonesoft.Controls
{
    public partial class FormDetailControl : DevExpress.XtraEditors.XtraUserControl
    {
        private XtraForm _form;

        public XtraForm Form
        {
            get
            {
                return _form;
            }
            set
            {
                _form = value;
                if (_form != null)
                {
                    _form.KeyDown += _form_KeyDown;
                }
            }
        }

        void _form_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            switch (e.KeyData)
            {
                    case Keys.Escape:
                    Form.Hide();
                    break;
            }
        }

        private void Sair()
        {
            Form.Hide();
        }

        public FormDetailControl()
        {
            InitializeComponent();
            
        }

        private void simpleButton1_Click(object sender, System.EventArgs e)
        {
            Sair();
        }

        

    }
}
